package com.sd.projectinterface;

import java.text.DecimalFormat;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MyStats extends Activity{
	
	TextView totalPoints, fastestTime;
	Button back;
	int id;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_scores);
		MyApplication myApp = (MyApplication) getApplicationContext();
		DecimalFormat df = new DecimalFormat("#.###");
		totalPoints = (TextView) findViewById(R.id.total_points);
		fastestTime = (TextView) findViewById(R.id.fastest_time);
		back = (Button) findViewById(R.id.back);
		
		totalPoints.setText(totalPoints.getText()+" "+myApp.getScore());
		fastestTime.setText(fastestTime.getText()+" "+df.format(myApp.getTime())+" seconds");
		id = myApp.getId();
		
		back.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent i = new Intent(MyStats.this, MainActivity.class);
				i.putExtra("j", id);
				startActivity(i);
			}
		});
	}
	
}
